package com.example.shellshopping.YCB_settings;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.example.shellshopping.R;

public class YCBSettingsXiaoxiActivity extends AppCompatActivity {

    ImageView back,one,two;
    RelativeLayout rl1,rl2;
    int changeStyle1 = 0,changeStyle2 = 0;
    private void setListener() {
        back.setOnClickListener(onClickListener);
        rl1.setOnClickListener(onClickListener);
        rl2.setOnClickListener(onClickListener);

    }

    private void initView() {
        back = findViewById(R.id.ycb_settings_xiaoxi_back);
        one = findViewById(R.id.ycb_settings_xiaoxi_one_selected);
        two = findViewById(R.id.ycb_settings_xiaoxi_two_selected);
        rl1 = findViewById(R.id.ycb_settings_xiaoxi_rl_1);
        rl2 = findViewById(R.id.ycb_settings_xiaoxi_rl_2);
    }

    View.OnClickListener onClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.ycb_settings_xiaoxi_back:
                    finish();
                    break;
                case R.id.ycb_settings_xiaoxi_rl_1:
                    changeStyle1();
                    break;
                case R.id.ycb_settings_xiaoxi_rl_2:
                    changeStyle2();
                    break;
            }
        }
    };

    private void changeStyle1() {
        if (changeStyle1 == 0) {
            one.setVisibility(View.VISIBLE);
            changeStyle1 = 1;
        }else{
            one.setVisibility(View.INVISIBLE);
            changeStyle1 = 0;
        }
    }

    private void changeStyle2() {
        if (changeStyle2 == 0) {
            two.setVisibility(View.VISIBLE);
            changeStyle2 = 1;
        }else{
            two.setVisibility(View.INVISIBLE);
            changeStyle2 = 0;
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ycb_settings_xiaoxi_activity);
        initView();
        setListener();
    }
}